package wangxiaotao.service;

import com.baomidou.mybatisplus.extension.service.IService;
import wangxiaotao.bean.vo.OrderVO;
import wangxiaotao.entity.Order;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author wang
 * @since 2022-03-22
 */
public interface OrderService extends IService<Order> {
    //订单取消 缓存前缀
    String ORDER_CANCEL_PREFIX = "oder:cache:cancel:";

    //订单确认 确认前缀
    String ORDER_OK_PREFIX = "oder:cache:ok:";

    //订单取消 缓存时间 半小时
    Integer ORDER_CANCEL_TIME = 1800;

    //订单确认 缓存时间 3天
    Integer ORDER_OK_TIME = 60*60*72;


    /**
     * 根据订单状态判断是否能修改订单数据
     * @param orderVO
     */
    void judgeOrderStatue(OrderVO orderVO);

    void judgeOrderStatue(Integer[] orderIds);

    List<Map<String,Object>> getSaleForLast7();


    default String getOrderOkPrefix(){
        return ORDER_OK_PREFIX;
    }
    default String getOrderCancelPrefix(){
        return ORDER_CANCEL_PREFIX;
    }

    default Integer getOrderCancelTime(){
        return ORDER_CANCEL_TIME;
    }
    default Integer getOrderOkTime(){
        return ORDER_OK_TIME;
    }

    default String getRealOrderCancelPrefix(String OrderNo){
        return ORDER_CANCEL_PREFIX + OrderNo;
    }
    default String getRealOrderOkPrefix(String OrderNo){
        return ORDER_OK_PREFIX + OrderNo;
    }

}
